﻿/**
* @Depends base.bizproc.js
*/
ksg.ui.bizprocs.mediaItemsManagement = function (id, dataParams) {
	return new ksg.ui.BizProc(id, dataParams, {
		imgOptions: dataParams["media-options"],
		bizRules: {
			getBizObjListBizRule: "getMediaItems",
			updateBizRule: "updateMediaItem",
			getBizObjBizRule:"getMediaItemDetails"
		},

		CurrentEditPrivilege: function () {
			return ksg.security.Privileges.Delete;
		},

		_getBizObjDetailRuleParameters: function (id) {
			var bizobj = this.currentBizObj;
			return { name: id, cacheName: this.imgOptions.cacheName, previewSize: this.imgOptions.previewSize};
		},
		_getBizObjListRuleParameters: function () {
			var options = $.extend({
				stripLeading: !this.CanEdit()
			}, this.imgOptions);
			var pid = this._getParentBizProcValue("pid");
			if (pid != null)
				options.parentPath = pid.replace(/:/g, "/");
			else
				options.parentPath = "";

			return options;
		},
		_getUpdateBizObjRuleParams: function (bizObj) {
			//bizObj["cacheName"] = this.imgOptions.cacheName;
			return bizObj;
		},
		_keyName: "name"
	});
};


